#include "Comment.hpp"

int main()
{
    //创建管道
    int m=mkfifo(filename.c_str(),mode);
    if(m<0)
    {
        perror("管道创建失败\n");
        return -1;
    }
    else
    {
        cout<<"创建成功"<<endl;
        //读取数据
        int fd= open(filename.c_str(), O_RDONLY);
        while (true)
        {
            char arr[SIZE] = {0};
            int n = read(fd, arr, sizeof(arr) - 1);
            arr[n] = '\0';
            cout << arr << endl;
        }
        close(fd);
        int m = unlink(filename.c_str());
        (void)m;
    }
    return 0;
}